package cn.kgc.vue.config;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Author 张航
 * @Date 2024/7/2
 * @Description
 */
@Configuration
@EnableSwagger2
public class Swagger2WebConfig {
    //设置哪些接口需要生成接口文档

    @Bean
    public Docket docket() {
      return   new Docket(DocumentationType.SWAGGER_2)
              .groupName("java2424")     //设置组信息
              .apiInfo( apiInfo())                //设置接口文档首页信息
              .select()
              .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
              .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
              .build();


    }

public ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("API文档标题")
            .description("API文档描述")
            .version("1.0")
            .build();
}

}
